import 'package:flutter/material.dart';
import 'package:x3_base_core/x3_base_core.dart';
import '../mixin/advanced_filter_select_mixin_style_two.dart';
import 'package:x3_form_core/models/base_advanced_filter_model.dart';


class AdvancedFilterSingleChoiceStyleTwo extends StatefulWidget {
  final BaseAdvancedFilterModel model;

  const AdvancedFilterSingleChoiceStyleTwo({Key key, this.model}) : super(key: key);

  @override
  _AdvancedFilterSingleChoiceStyleTwoState createState() => _AdvancedFilterSingleChoiceStyleTwoState();
}

class _AdvancedFilterSingleChoiceStyleTwoState extends State<AdvancedFilterSingleChoiceStyleTwo> with AdvancedFilterSelectMixinStyleTwo {
  @override
  Widget build(BuildContext context) {
    return buildItemContainer();
  }

  @override
  List<BaseKeyValueModel> get children => widget.model.selectData ?? [];

  @override
  BaseAdvancedFilterModel get model => widget.model;

  @override
  onChange(bool v, BaseKeyValueModel data) {
    onSingleChangeEvent(v, data);
    baseRequestFormProvider.setDataSource(this.model, selectedList.length == 1 ? selectedList.first.toJson() : {});
    setState(() {});
  }
}
